<?php
/**
 * CreateTime: 2023/5/31 10:15
 */

namespace App\Models\ShortLink;

use App\Consts\TableConsts\TableConsts;
use App\Models\BaseModelV2;

class ShortLinkModel extends BaseModelV2
{
    protected $table = TableConsts::SHORT_LINK_HASH;

    protected $primaryKey = 'short_link_id';

    protected $fillable = [
        'short_link_id',
        'short_link_code',
        'url',
    ];


    protected static function booted()
    {
       // parent::booted(); // TODO: Change the autogenerated stub
    }

    public function getUrlByShortLinkUrl($short_link_url){
        return $this->select(["short_link_id","url"])->where('short_link_code',$short_link_url)->first();
    }

}